package com.example.scaletest;

import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.List;

public class ChoiceAdapter extends BaseQuickAdapter<ItemSetEntity, BaseViewHolder> {
    public ChoiceAdapter(int layoutResId, @Nullable List<ItemSetEntity> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ItemSetEntity item) {

        LinearLayout ll =helper.getView(R.id.ll_chose);
        TextView tv_name = helper.getView(R.id.tv_chose_name);
        if (!item.isChose()){
            ll.setBackgroundResource(R.color.white);
            tv_name.setTextColor(Color.parseColor("#FF000000"));
        }else {
            ll.setBackgroundResource(R.color.colorPrimary);
            tv_name.setTextColor(Color.parseColor("#FFFFFFFF"));
        }
        helper.setText(R.id.tv_chose_name,item.getName());
    }
}
